package com.msb.c01;

/**
 * @author: xw
 * @create: 2022/9/22 10:13
 * @description: 如何创建线程
 */
public class Code02_HowToCreateThreads {

    static class MyThread extends Thread{
        @Override
        public void run(){
            System.out.println("myThread");
        }
    }

    static class MyRunnable implements  Runnable{

        @Override
        public void run() {
            System.out.println("myRunnable");
        }
    }
    //请你告诉我启动线程的三种方式 1：Thread 2: Runnable 3:Executors.newCachedThrad
    public static void main(String[] args) {
        new MyThread().start();
        new Thread(new MyRunnable()).start();
        new Thread(()-> System.out.println("lambda")).start();
    }
}
